package com.ruoyi.driver.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.driver.domain.TbDriverBank;
import com.ruoyi.driver.service.ITbDriverBankService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 司机银行卡记录表Controller
 * 
 * @author ruoyi
 * @date 2025-08-27
 */
@RestController
@RequestMapping("/bank")
public class TbDriverBankController extends BaseController
{
    @Autowired
    private ITbDriverBankService tbDriverBankService;

    /**
     * 查询司机银行卡记录表列表
     */
    //@RequiresPermissions("driver:bank:list")
    @GetMapping("/list")
    public TableDataInfo list(TbDriverBank tbDriverBank)
    {
        startPage();
        List<TbDriverBank> list = tbDriverBankService.selectTbDriverBankList(tbDriverBank);
        return getDataTable(list);
    }

    /**
     * 导出司机银行卡记录表列表
     */
    //@RequiresPermissions("driver:bank:export")
    @Log(title = "司机银行卡记录表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbDriverBank tbDriverBank)
    {
        List<TbDriverBank> list = tbDriverBankService.selectTbDriverBankList(tbDriverBank);
        ExcelUtil<TbDriverBank> util = new ExcelUtil<TbDriverBank>(TbDriverBank.class);
        util.exportExcel(response, list, "司机银行卡记录表数据");
    }

    /**
     * 获取司机银行卡记录表详细信息
     */
    //@RequiresPermissions("driver:bank:query")
    @GetMapping(value = "/{bankId}")
    public AjaxResult getInfo(@PathVariable("bankId") Integer bankId)
    {
        return success(tbDriverBankService.selectTbDriverBankByBankId(bankId));
    }

    /**
     * 新增司机银行卡记录表
     */
    //@RequiresPermissions("driver:bank:add")
    @Log(title = "司机银行卡记录表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbDriverBank tbDriverBank)
    {
        return toAjax(tbDriverBankService.insertTbDriverBank(tbDriverBank));
    }

    /**
     * 修改司机银行卡记录表
     */
    //@RequiresPermissions("driver:bank:edit")
    @Log(title = "司机银行卡记录表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbDriverBank tbDriverBank)
    {
        return toAjax(tbDriverBankService.updateTbDriverBank(tbDriverBank));
    }

    /**
     * 删除司机银行卡记录表
     */
    //@RequiresPermissions("driver:bank:remove")
    @Log(title = "司机银行卡记录表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{bankIds}")
    public AjaxResult remove(@PathVariable Integer[] bankIds)
    {
        return toAjax(tbDriverBankService.deleteTbDriverBankByBankIds(bankIds));
    }
}
